#include<bits/stdc++.h>
using namespace std;

int main() {
  int q;
  cin >> q;
  vector<int> ans;
  while (q--) {
    int k;
    cin >> k;
    vector<int> v(k);
    for (int i = 0; i < k; i++) {
      cin >> v[i];
    }
    bool f = true;
    for (int i = 1; i < k; i++) {
      if (v[i] <= v[i-1]) {
        f = false;
        break;
      }
    }
    if (!f) {
      cout << "NO" << endl;
      return 0;
    }
    for (int num : v) {
      ans.push_back(num);
    }
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size()-1; i++) {
    if (ans[i] == ans[i+1]) {
      cout << "NO" <<endl;
      return 0;
    }
  }
  if (ans.back() - ans[0] == ans.size() - 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}